import { info } from '@/api/sysconfig'

const state = {
  commentCount: 0
}

const mutations = {
  SET_COMMENT_COUNT: (state, count) => {
    state.commentCount = count
  }
}

const actions = {
  info({ commit }) {
    return new Promise((resolve, reject) => {
      info().then((response) => {
        const { result } = response
        commit('SET_COMMENT_COUNT', result)
        resolve()
      }).catch((error) => {
        reject(error)
      })
    })
  },
  resetConfig({ commit }) {
    return new Promise(resolve => {
      commit('SET_SYS_CONFIG', '')
      resolve()
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
